<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>仁爱宠物医院</title>
  <link rel="stylesheet" href="../css/home.css">
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <script src="https://unpkg.com/vue@2/dist/vue.js"></script>
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
  <link href="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://cdn.staticfile.net/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
  <script src="https://www.jq22.com/demo/number202111050044/js/number.js"></script>
</head>

<body>
  <div id="join">
    <!-- 页面头部 -->
    <header>
      <div style="display: flex;">
        <div class="container">
          <div class="row">
            <div class="col-lg-1" style="text-align: right;">
              <img src="../img/cat-foot.svg" height="40px" width="40px" />
            </div>
            <div class="col-lg-2" style="padding: 0;text-align: left;color: #ff5b2e;padding-top: 3px;">
              <h3 style="font-weight: 700; font-family: 得意黑;">仁爱宠物医院</h3>
            </div>
            <div class="col-lg-7">
              <ul style="font-family: 得意黑;">
                <li class="li_header"><a class="a_header" href="./home.html">首页</a></li>
                <li class="li_header"><a class="a_header" href="./about.html">关于仁爱</a></li>
                <li class="li_header"><a class="a_header" href="./service.html">服务项目</a></li>
                <li class="li_header"><a class="a_header" href="./keep_a_pet.html">养宠小百科</a></li>
                <li class="li_header"><a class="a_header" href="./join_us.html">加入我们</a></li>
                <li class="li_header"><a class="a_header" href="./shop.html">线上商店</a></li>
                <li class="li_header"><a class="a_header" href="./message.html">在线留言</a></li>
                <li id="li_1" class="li_header"><a class="a_header" href="./login.html">登录/注册</a></li>
                <li id="li_2" class="li_header"><a class="a_header" href="./userinfo.html">个人中心</a></li>
              </ul>
            </div>
            <div class="col-lg-2" style="text-align: left;overflow: hidden; position: relative;">
              <input type="text" style="margin-top: 8px;" v-model="goodsName">
              <img @click="search()" src="../img/search.png" alt="" width="23px" height="23px"
                style="position: absolute; top: 11px; left: 135px; cursor: pointer;">
            </div>
          </div>
        </div>
      </div>
    </header>
    <!-- 一 -->
    <section style="position: relative;">
      <div style="margin: auto;">
        <img style="z-index: 1;" src="../img/contact_bg.jpg" alt="" width="100%">
      </div>
      <div style="position: absolute; bottom: 12%; left: 22.5%;z-index: 999;">
        <h2 style="text-align: center; margin-bottom: 5%;">加入我们</h2>
        <form action="#">
          <label for="name">名字：</label><input style="padding-left: 15px; height: 50px; width: 350px;" type="text"
            name="name" id="name">
          <label style="margin-left: 5px;" for="phone">电话：</label><input
            style="padding-left: 15px; height: 50px; width: 350px;" type="text" name="phone" id="phone"><br><br>
          <label for="email">邮箱：</label><input style="padding-left: 15px; height: 50px; width: 350px;" type="text"
            name="email" id="email">
          <label style="margin-left: 5px;" for="skills">技能：</label><input
            style="padding-left: 15px; height: 50px; width: 350px;" type="text" name="skills" id="skills">
          <br><br>
          <label for="message">为什么加入我们：</label><br><br><textarea
            style="padding: 20px; outline: none; border-radius: 20px; resize: none;" name="message" id="message"
            cols="80" rows="8"></textarea>
          <h3 onclick="joinUs()" style="text-align: center; margin-top: 2%;"><input
              style="height: 50px; font-size: 20px;" type="button" value="提交"></h3>
        </form>
      </div>
    </section>
    <!-- 页尾 -->
    <footer style="background-color: #2f2d53;height: 350px; overflow: hidden; padding-top: 5%;">
      <div class="container">
        <div style="display: flex; padding-left: 20%;">
          <div style="width: 35%;">
            <div style="display: flex;">
              <div style="text-align: right;">
                <img src="../img/cat-foot.svg" height="40px" width="40px" />
              </div>
              <div style="padding: 0;text-align: left;color: #ff5b2e;padding-top: 3px;">
                <h3 style="font-weight: 700; font-family: 得意黑;">仁爱宠物医院</h3>
              </div>
            </div>
            <div style="color: #fff; margin-top: 5%;">
              <span>
                宠物护理和兽医服务对于维持<br>我们心爱的动物伴侣的健康和福祉至关重要
              </span>
            </div>
          </div>
          <div style="display: flex; width: 65%;">
            <div style="overflow: hidden; margin-left: 15%;">
              <h4 style="color: #fff;">快速链接</h4><br>
              <h6><a style="color: #fff !important;" href="./about.html">关于我们</a></h6><br>
              <h6><a style="color: #fff !important;" href="./service.html">服务项目</a></h6><br>
              <h6><a style="color: #fff !important;" href="./service.html">线上商店</a></h6>
            </div>
            <div style="overflow: hidden; margin-left: 15%;">
              <h4 style="color: #fff;">法律</h4><br>
              <h6 style="color: #fff;">常见问题</h6><br>
              <h6 style="color: #fff;">条款及细则</h6><br>
              <h6 style="color: #fff;">隐私与政策</h6>
            </div>
          </div>
        </div>
        <span style="color: #fff; display: block; text-align: center; font-size: 14px; margin-top: 2%;">©2024年
          版权所有仁爱宠物医院</span>
      </div>
    </footer>
  </div>
</body>
<script>
  // 当页面刚加载完时调用
  window.onload = function () {
    if (localStorage.getItem("userId")) {
      // 说明已经登录
      let li_1 = document.getElementById('li_1');
      li_1.style.display = "none";
      let li_2 = document.getElementById('li_2');
      li_2.style.display = 'block';
    } else {
      //没有登录
      let li_1 = document.getElementById('li_1');
      li_1.style.display = "block";
      let li_2 = document.getElementById('li_2');
      li_2.style.display = 'none';
    }
  }

  // 加入我们
  function joinUs() {
    if (localStorage.getItem("userId") == null) {
      window.location.href = './login.html';
      return;
    }
    // 获取不同数据
    let name = document.getElementById('name').value;
    let phone = document.getElementById('phone').value;
    let email = document.getElementById('email').value;
    let skills = document.getElementById('skills').value;
    let message = document.getElementById('message').value;
    // 整合数据
    let contact = {
      "name": name,
      "phone": phone,
      "email": email,
      "skills": skills,
      "message": message
    }
    // 判断里面的值是不是空的，
    if (contact.name == "" || contact.phone == "" || contact.email == "" || contact.skills == "") {
      // 表示什么数据都没有填
      alert("请填写好数据在进行提交！");
      return;
    }
    // 发送请求
    $.ajax({
      type: 'POST',
      url: 'http://localhost:8082/contact/insert',
      dataType: 'json',
      contentType: 'application/json',
      data: JSON.stringify(contact),
      success: function (data) {
        if (data.flag) {
          alert(data.message);
          window.location.href = './join_us.html';
        } else {
          alert(data.message);
          window.location.href = './join_us.html';
        }
      }
    })
  }
</script>
<script>
  new Vue({
    el: '#join',
    data() {
      return {
        goodsName: ''
      }
    },
    methods: {
      search() {
        const name = document.getElementById("name").value;
        window.location.href = './shop.html'
      }
    }
  })
</script>

</html>